{template 'public/header'}
{template 'public/comhead'}
{if $operation == 'display'}
<div class="main">
    <script src="https://libs.baidu.com/bootstrap/3.0.3/js/bootstrap.min.js"></script>
    <script>
        $(function () {
            $("[data-toggle='tooltip']").tooltip();
        });
    </script>
    {if empty($returnid)}
    <div class="panel panel-default">
        <div class="panel-heading">
            筛选
        </div>
        <div class="panel-body">
            <form action="./index.php" method="get" class="form-horizontal" role="form">
                <input type="hidden" name="c" value="site" />
                <input type="hidden" name="a" value="entry" />
                <input type="hidden" name="m" value="weisrc_dish" />
                <input type="hidden" name="do" value="creditsetting" />
                <input type="hidden" name="op" value="display" />
                <div class="form-group">
                    <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">关键字</label>
                    <div class="col-sm-2 col-lg-2">
                        <input class="form-control" name="keyword" id="" type="text" value="{$_GPC['keyword']}" placeholder="请输入门店名称">
                    </div>
                    <div class="col-sm-2 col-lg-2">
                        <button class="btn btn-default"><i class="fa fa-search"></i> 搜索</button>
                    </div>
                </div>
            </form>
        </div>
    </div>
    {/if}
    <div class="panel panel-default">
        <div class="table-responsive panel-body">
            <form action="" method="post" class="form-horizontal form" enctype="multipart/form-data">
                <table class="table table-hover">
                    <thead class="navbar-inner">
                    <tr>
                        <th style="width:33%;">门店名称</th>
                        <th style="width:33%;">消费一元奖励积分</th>
                        <th style="width:33%;text-align: right;" >操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    {loop $storeslist $item}
                    <tr>
                        <td>
                            {$item['title']}
                        </td>
                        <td>
                            <span class="label label-success" >
                            {if $item['is_default_givecredit']==1}
                            {$setting['payx_credit']}{else}
                            {$item['givecredit']}
                            {/if}
                            </span>
                        </td>
                        <td style="max-width:70px;text-align: right;">
                            <a class="btn btn-default btn-sm" href="{php echo $this->createWebUrl('creditsetting', array('id' => $item['id'], 'op' => 'post'))}" title="修改">修改</a>
                        </td>
                    </tr>
                    {/loop}
                    </tbody>
                </table>
            </form>
        </div>
    </div>
    {$pager}
</div>
{elseif $operation == 'post'}
<link rel="stylesheet" href="{$_W['siteroot']}addons/weisrc_dish/public/web/css/awesome-bootstrap-checkbox.css">
<div class="main">
    <form action="" method="post" class="form-horizontal form" enctype="multipart/form-data">
        <div class="panel panel-default">
            <div class="panel-heading">
                奖励积分设置
            </div>
            <div class="panel-body">
                <div class="form-group">
                    <label class="col-xs-12 col-sm-2 col-md-2 col-lg-2 control-label">奖励积分</label>
                    <div class="col-sm-6 col-md-8 col-xs-12">
                        <div class="input-group ">
                            <input type="text" name="givecredit" class="form-control" value="{if $store['is_default_givecredit']==1}{$setting['payx_credit']}{else}{$store['givecredit']}{/if}">
							<span class="input-group-btn">
								<button class="btn btn-default" type="button">分</button>
							</span>
                        </div>
                        <span class="help-block">消费1元奖励多少积分</span>
                    </div>
                </div>
            </div>
        </div>
        <div class="form-group col-sm-12">
            <input type="hidden" name="id" value="{$id}" />
            <input type="submit" name="submit" value="保存设置" class="btn btn-primary col-lg-3" />
            <input type="hidden" name="token" value="{$_W['token']}" />
        </div>
    </form>
</div>
{/if}
{if $_W['isfounder']}
{template 'common/footer'}
{else}
{template 'public/footer'}
{/if}
